<template>
    <div class="courses-nav">
        <el-menu :default-active="activeIndex" class="el-menu-demo"  mode="horizontal" :router="true" v-if="roleId == 'TEACHER' || roleId == 'MARKET_TEACHER' ||  roleId == 'UNIVERSITY_TEACHER'" >
            <el-menu-item index="/Teaching/Course/CreativeCourse/CourseBaseInfo">基本信息</el-menu-item>
            <el-menu-item index="/Teaching/Course/CreativeCourse/CourseBaseOutline" :disabled="chaperFlag">课程大纲</el-menu-item>
            <el-menu-item index="/Teaching/Course/CreativeCourse/ChapterInfo" :disabled="chaperFlag">章节信息</el-menu-item>
            <el-menu-item index="/Teaching/Course/CreativeCourse/ChapterClassification" :disabled="mark">章节分类</el-menu-item>
            <el-menu-item index="/Teaching/Course/CreativeCourse/ItemBankList" :disabled="mark">考试试题</el-menu-item>
            <el-menu-item index="/Teaching/Course/CreativeCourse/Experiment/CourseTemplate"  :disabled="mark">实验环境</el-menu-item>
        </el-menu>
        <el-menu :default-active="activeIndex" class="el-menu-demo"  mode="horizontal" :router="true"  v-if=" roleId == 'INTERNET_ADMIN' || roleId == 'SUPER_ADMIN'" >
            <el-menu-item index="/Admin/CreativeCourse/CourseBaseInfo">基本信息</el-menu-item>
            <el-menu-item index="/Admin/CreativeCourse/CourseBaseOutline" :disabled="chaperFlag">课程大纲</el-menu-item>
            <el-menu-item index="/Admin/CreativeCourse/ChapterInfo" :disabled="chaperFlag">章节信息</el-menu-item>
            <el-menu-item index="/Admin/CreativeCourse/ChapterClassification" :disabled="mark">章节分类</el-menu-item>
            <el-menu-item index="/Admin/CreativeCourse/ItemBankList" :disabled="mark">考试试题</el-menu-item>
            <el-menu-item index="/Admin/CreativeCourse/Experiment/CourseTemplate"  :disabled="mark">实验环境</el-menu-item>
        </el-menu>

    </div>
</template>

<script>
    export default {
        props:{
            mark:Boolean,
            chaperFlag:Boolean,
        },
        data () {
            return {
                activeIndex: "",
                roleId:''
            }
        },
         created() {
            this.roleId = this.$store.state.user.roles[0]
            this.fetchDate()
        },
        methods: {
            fetchDate() {
                let self = this
                var cur_path =  self.$route.meta.navActive //获取当前路由
                self.activeIndex = cur_path
            }
        },
        watch: {
            "$route": "fetchDate",
		}
    }
</script>
<style lang="scss" scoped>
    .courses-nav{
        .el-menu-demo{
            .el-menu-item{
                i{
                    vertical-align: sub;
                    margin-right: 10px;
                }
                &:hover{
                     color:#1277eb
                }
            }
            & >.is-disabled:hover {
                color:#474747
            }
        }
    }
</style>
